//
//  SettlementCell.m
//  Futures
//
//  Created by Cheng on 2017/7/6.
//  Copyright © 2017年 Cheng. All rights reserved.
//

#import "SettlementCell.h"

@implementation SettlementCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (void)setCellWithModel:(CloseOrderModel *)model{
    NSString *dateTime = model.CloseDate;
    NSArray *array = [dateTime componentsSeparatedByString:@"T"];
    self.date.text = array[0];
    self.time.text = array[1];
    self.symbolName.text = model.Symbol;
    [self.buySellDirection setTitle:model.OpenBuySell forState:UIControlStateNormal];
    
    if (model.RealizedPL>=0) {
        NSString *str = [NSString stringWithFormat:@"+%d 元",model.RealizedPL];
        self.profit.attributedText = [NSString stringWithaString:str bigFont:21 smallFont:15 color:[UIColor redColor]];
    }else{
        NSString *str = [NSString stringWithFormat:@"%d 元",model.RealizedPL];
        self.profit.attributedText = [NSString stringWithaString:str bigFont:21 smallFont:15 color:[UIColor greenColor]];
    }
    
    
}
@end
